﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace wsn.model
{
    public class Sensor
    {
        private int id;        

        public int Id
        {
            get {   return id; } 
            set {   id = value; } 
        }
        private SensorType type=new SensorType();         //节点类型

        public SensorType Type
        {
            get { lock (type) { return type; } }
            set { lock (type) { type = value; } }
        }
        private int insideId;         //节点在Zigbee网络中的ID号

        public int InsideId
        {
            get {  return insideId;  }
            set {  insideId = value; }
        }
        private String ipv6="";             //为节点在上层应用而分配的IP

        public String Ipv6
        {
            get { lock (ipv6) { return ipv6; } }
            set { lock (ipv6) { ipv6 = value; } }
        }
        private Int32 saveDistance;       //存储间隔

        public Int32 SaveDistance
        {
            get { return saveDistance; }
            set { saveDistance = value; }
        }
        private Int32 nowDistance;       //当前间隔

        public Int32 NowDistance
        {
            get { return nowDistance; }
            set { nowDistance = value; }
        }
        private Int32 verifyParameter;   //验证参数 为0表示无需验证

        public Int32 VerifyParameter
        {
            get { return verifyParameter; }
            set { verifyParameter = value; }
        }

        private DataReceive deal; //数据到达时的处理过程

        public DataReceive Deal
        {
            get { lock (deal) { return deal; } }
            set { lock (deal) { deal = value; } }
        }


        public void onReceive(wsn.ap.AccessPointData ap)
        {
            if (Deal != null)
                Deal(ap);
        }

    }
}
